<cfparam name="dir" default="/">

<cfimage action = "info" source="#request.basepath#images#dir#/#photo#" structName="imginfo">

<cfif NOT directoryexists('#request.basepath#images#dir#thumbs')>
	<cfdirectory action="create" directory="#request.basepath#images#dir#thumbs">
</cfif>
<!---Thumbnail--->	
<cfif imginfo.width GT #request.ThumbSize#>
<cfimage action="resize"
source="#request.basepath#images#dir##Photo#"
width="#request.ThumbSize#"
height=""
destination="#request.basepath#images#dir#thumbs/#Photo#"
overwrite="yes"> 
<cfelse><!---Just copy it--->
<cffile action = "copy" source="#request.basepath#images#dir##photo#" destination="#request.basepath#images#dir#thumbs/#photo#" nameconflict="overwrite" mode="777">
</cfif>

<!---Now read all three so that the height and width can be stored in the db for future use--->
<cfimage Action = "info" source="#request.basepath#images#dir##photo#" structName="imginfo">
<cfset iHeight = #imginfo.HEIGHT#>
<cfset iWidth = #imginfo.WIDTH#>
	
<cfimage Action = "info" source="#request.basepath#images#dir#thumbs/#photo#" structName="imginfo">
<cfset iThumbHeight = #imginfo.HEIGHT#>
<cfset iThumbWidth = #imginfo.WIDTH#>